//
//  LDShowHUB.swift
//  DingDongZP
//
//  Created by 三秒文化 on 16/5/6.
//  Copyright © 2016年 iyhjiang.com. All rights reserved.
//

import UIKit
import SVProgressHUD
import WSProgressHUD
import JDStatusBarNotification

class LDShowHUB: NSObject {
    
    //入口
    class var shareInstance:LDShowHUB {
        struct Instance {
            static let instance = LDShowHUB()
        }
        return Instance.instance
    }
    //
    func showErr(str:String) {
        
        SVProgressHUD.showErrorWithStatus(str)
//        SVProgressHUD.dismiss()
    }
    
    func showSucc(str:String) {
        
        SVProgressHUD.showSuccessWithStatus(str)
//        SVProgressHUD.dismiss()
    }
    
    func showStaus(str:String) {
//        SVProgressHUD.dismiss()
        SVProgressHUD.showWithStatus(str)
    }
    
    func showBarStatus(str:String) {
        JDStatusBarNotification.showWithStatus(str, dismissAfter: 1.5,styleName: "styleDefault")
    }
    
    func dissmiss() {
        SVProgressHUD.dismiss()
        JDStatusBarNotification.dismiss()
    }
    
    override init() {
        super.init()
        
        JDStatusBarNotification.addStyleNamed("styleDefault") { (barStyle) -> JDStatusBarStyle! in

            let style = JDStatusBarStyle()
            style.barColor = LDGolbalColor.GreenAssist
            style.textColor = LDGolbalColor.White
            style.font = LDFont.Font14
            style.animationType = JDStatusBarAnimationType.Move
            style.progressBarHeight = 15
            
            return style
        }
        
        SVProgressHUD.setDefaultStyle(SVProgressHUDStyle.Dark)
        SVProgressHUD.setMinimumDismissTimeInterval(1)
        SVProgressHUD.setDefaultMaskType(SVProgressHUDMaskType.Black)
    }
}
